package com.suray.wcs.service.enums;

/**
 * @author Charles on 2018/8/9.
 */
public enum RunningStatus {
    /**
     * 停止
     */
    STOP(0, "停止"),
    /**
     * 暂停
     */
    PAUSE(1, "暂停"),
    /**
     * 运行中
     */
    RUNNING(2, "运行");
    /**
     * 对应数字
     */
    private int statusNum;
    private String description;

    @Override
    public String toString() {
        return description;
    }

    RunningStatus(int statusNum, String description) {
        this.statusNum = statusNum;
        this.description = description;
    }

    public static RunningStatus parseStatus(int statusNum) {
        for (RunningStatus r : RunningStatus.values()) {
            if (r.getStatusNum() == statusNum) {
                return r;
            }
        }
        throw new IllegalArgumentException("匹配行驶状态参数异常");
    }

    public int getStatusNum() {
        return statusNum;
    }
}
